package garin.parse.sql.sql2003;

import garin.parse.Token;

import java.io.IOException;

public class ControlToken extends Token implements StatementOperator {
	int count;
	
	protected ControlToken(final Token parent) {
		super(parent);
	}
	
	@Override
	public boolean accept() throws IOException {
		final char ch = source().ch();
		final boolean accept = ch == ',' || ch == '(' || ch == ')' || ch == '=';
		return accept;
	}
	
	@Override
	public Token on() throws Exception {
		return count++ == 0 ? self() : up();
	}
}
